<template>
	<div>
		<el-select
			v-model="data.sendValue"
			filterable
			allow-create
			default-first-option
			:reserve-keyword="false"
			placeholder="发送信息调侃对方吧"
			@change="sendChange"
		  >
			<el-option
			  v-for="item in data.options"
			  :key="item.value"
			  :label="item.label"
			  :value="item.value"
			/>
		  </el-select>
	</div>
	
</template>

<script lang="ts" setup>
	import { ref,onMounted,reactive,inject,onBeforeUnmount,watch,onUnmounted,nextTick,defineProps } from 'vue'
	import { playAudio } from '../main/webServer'
	import { sendMessage } from "../main/webServer"
	const store = inject('store')
	let props = defineProps({
		roomId:Number|null
	})
	let data = reactive({
		sendValue:"",
		options:[{
			value: '快点吧，我等的花儿都谢了',
			label: '快点吧，我等的花儿都谢了',
		  },
		  {
			value: '房主快点开始游戏',
			label: '房主快点开始游戏',
		  },
		  {
			value: '你是MM还是GG',
			label: '你是MM还是GG',
		  },
		  {
			value: '面对疾风吧',
			label: '面对疾风吧',
		  },{
			value: '我的大刀早已饥渴难耐了',
			label: '我的大刀早已饥渴难耐了',
		  },{
			value: '是时候展现真正的技术了',
			label: '是时候展现真正的技术了',
		  },{
			value: '不要走决战到天亮',
			label: '不要走决战到天亮',
		  },{
			value: '下次再玩,我要先走了',
			label: '下次再玩,我要先走了',
		  }],
		
	})
	const sendChange = (e)=>{
		console.log(e,props.roomId)
		if(!props.roomId){
			return
		}
		let info = {
			infoType:'gameMessage',
			to:store.state.userInfoX.account,
			content:e,
			roomId:props.roomId
		}
		let result = sendMessage(info)
		if(result){
			
		}
	}
	
</script>

<style>
</style>
